<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:68:"D:\phpStudy\WWW\qd\public/../application/index\view\login\login.html";i:1512463050;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>登录</title>
    <link rel="stylesheet" href="__STATIC__/css/base.css"/>
    <link rel="stylesheet" href="__STATIC__/css/login.css"/>
    <script src="__STATIC__/js/jquery-1.11.1.min.js"></script>
    <script src="__STATIC__/js/form_validation.js"></script>
    <script src="__STATIC__/js/layer/layer.js" type="text/javascript"></script>
    <script src="__STATIC__/js/base.js"></script>
</head>

<body style="background:url('/static/images/login.jpg') no-repeat center;" >
<div id="login" style="margin-top: -210px;">
    <!--<div id="login-content"><img src="__STATIC__/images/register.png" width="459" height="344"></div>-->
    <div id="login-form">
        <form action="../index.html"  onsubmit="return searchSub1()" id="login_form">
            <div id="form-title">用户登录</div>
            <div class="formline">
                <div class="formtitle">账户</div>
                <div class="formcontent">
                    <input type="text" style="position:absolute; opacity: 0; z-index: -1;display:none;">
                    <input tabindex="1" id="user_name" class="inputstyle1" autocomplete="off"  maxlength="15" type="text" name="username" placeholder="请输入注册手机号或用户名"/>
                    <input type="text" style="position:absolute; opacity: 0; z-index: -1;display:none;">
                    <span class="success"></span>
                </div>
                <div class="prompt"></div>
            </div>

            <div class="formline">
                <div class="formtitle">密码</div>
                <div class="formcontent">
                    <input type="text" style="position:absolute; opacity: 0; z-index: -1;display:none;">
                    <input tabindex="2" id="pwd" oninput="if(!this.value){this.type='text'}else{this.type='password'}" class="inputstyle1"  autocomplete="off" maxlength="32"  type="text" name="loginPwd" placeholder="请输入6-32位由数字和字母组成的密码"/>
                    <input type="text" style="position:absolute; opacity: 0; z-index: -1;display:none;">
                    <span class="success"></span>
                </div>
                <div class="prompt"></div>
            </div>
            <div>
                <p>
                    <input type="button" value="登录" class="sublimitstyle" id="sublimit"/>
                </p>
            </div>
            <div id="passwordthing">
                <div id="remeber"><input type="checkbox" name="remeber" value="Car" checked="checked" style="vertical-align:middle"/> 记住密码
                </div>
                <div id="forget"><a href="findpwd.html">忘记密码？</a></div>
            </div>
        </form>
        <div class="possess">没有账号？<a href="register.html" >立即注册</a></div>
    </div>
</div>
</body>
</html>
<script>
    $(function(){
        /*tab键与enter键事件开始*/
        keyevent($("#user_name"),$("#pwd"));
        keyevent($("#pwd"),$("#sublimit"));
        /*tab键与enter键事件结束*/
    })

    //提交表单
    $('#sublimit').on('click',function(){
        var url = window.location.href;
        var validate = searchSub1();
        if(validate){
            $.ajax({
                cache: true,
                type: "POST",
                url: url,
                data:$('#login_form').serialize(),// 你的formid
                async: false,
                error: function(request) {
                    layer.msg('登录失败', {
                        icon: 2,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    });
                },
                success: function(data) {
                    if(data.code =='ok'){
                        var url=document.referrer;
                        var w=url.lastIndexOf('/');
                        var x=url.lastIndexOf(".");
                       if(url == null ||url == '' ){
                           window.location.href='/index.html'
                       }else {
                           if(url.substring(w+1,x)=="register"){
                               window.location.href='/index.html'
                           }else {
                               window.history.back(-1);
                           }
                       }
                    }else {
                        if(data.type == 'password'){
                            $('#pwd').parents('.formline').children('.prompt').show();
                            $('#pwd').parents('.formline').children('.prompt').html(data.msg);
                        }else if(data.type == 'mobile') {
                            $('#user_name').parents('.formline').children('.prompt').show();
                            $('#user_name').parents('.formline').children('.prompt').html(data.msg);
                        }else {
                            $('.no').show();
                        }
                    }
                }
            });
        }
    });
</script>
